package com.jie.store.impl;

import com.jie.dto.UploadImageDTO;
import com.jie.service.impl.FileService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.util.Map;

/**
 * minio上传策略实现
 * @Author: 杰
 * @Project :net-disk
 * @DateTime: 2024/4/27 15:05
 **/
@Slf4j
@Service("minioUploadStrategyImpl")
public class MinioUploadStrategyImpl extends AbstractUploadStrategyImpl{
    @Autowired
    private FileService fileService;
    /**
     * 上传文件
     * @param multipartFile 输入流
     * @throws IOException
     */
    @Override
    public String upload(MultipartFile multipartFile) throws IOException {

           return fileService.uploadFile(multipartFile);
    }

    @Override
    public UploadImageDTO uploadImages(MultipartFile file) {
        return fileService.uploadImage(file);
    }

    /**
     * 视频上传策略 应该返回预览视频+视频详细地址
     * @param file
     * @return
     */
    @Override
    public String uploadVideo(MultipartFile file) {
        return fileService.uploadVideo(file);
    }

    @Override
    public boolean removeFile(String url,String fileName) {
        return fileService.removeFile(url,fileName);
    }

}
